#!/usr/bin/python3
# -*- coding:utf-8 -*-
# @Time   :2021/12/11
# @Author :songtx
# @File   :write_mysql.py
import serial
import time       
import binascii
import codecs
import struct

a1=0
s = serial.Serial("/dev/ttyS0",9600)  

while (a1<=1):
		fasong = "110400000002735B"
		Hex_str=(codecs.decode(fasong, 'hex'))
		s.write(Hex_str)
		n=s.inWaiting()
		a1=a1+1
		if n:
			str1= binascii.b2a_hex(s.read(n))
			date = codecs.encode(str1)
        	
			print(date)
			print("sss")
		time.sleep(1)
s.flushInput()
